package org.javaboy.vhr.service;

import org.javaboy.vhr.mapper.EmployeeecMapper;
import org.javaboy.vhr.mapper.EmployeeremoveMapper;
import org.javaboy.vhr.model.*;
import org.javaboy.vhr.vo.EmpEcVo;
import org.javaboy.vhr.vo.EmpRemoveVo;
import org.javaboy.vhr.vo.RespPageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Author: cheng
 */
@Service
public class EmployeeremoveService {
    @Autowired
    private EmployeeremoveMapper employeeremoveMapper;

    public RespPageBean getEmployeeremoveByPage(Integer page, Integer size, Employeeremove employeeremove, Date[] beginDateScope) {
        if (page != null && size != null) {
            page = (page - 1) * size;
        }
        List<EmpRemoveVo> data = employeeremoveMapper.getEmployeeremoveByPage(page,size,employeeremove,beginDateScope);

        Long total = employeeremoveMapper.getTotal(employeeremove, beginDateScope);
        RespPageBean bean = new RespPageBean();
        bean.setData(data);
        bean.setTotal(total);
        return bean;
    }

    public List<Department> getTotalDepartment(){
        return employeeremoveMapper.getTotalDepartment();
    }

    public List<Position> getTotalPosition(){
        return employeeremoveMapper.getTotalPosition();
    }

    public int add(Employeeremove employeeremove){
        return employeeremoveMapper.insertSelective(employeeremove);
    }

    public int update(Employeeremove employeeremove){
        return employeeremoveMapper.updateByPrimaryKeySelective(employeeremove);
    }

    public int delete(Integer id){
        return employeeremoveMapper.deleteByPrimaryKey(id);
    }


}
